package org.itheima.googleplay.utils;

import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.StateListDrawable;

/**
 * @包名: org.itheima.googleplay.utils
 * @类名: DrawableUtils
 * @作者: 肖琦
 * @创建时间 : 2015-3-23 上午10:42:48
 * 
 * @描述: drawable xml 对应的类的工具类
 * 
 * @SVN版本: $Rev: 16 $
 * @更新人: $Author: xq $
 * @更新时间: $Date: 2015-03-23 12:16:33 +0800 (星期一, 23 三月 2015) $
 * 
 * @更新描述:
 */
public class DrawableUtils
{

	public static GradientDrawable getGradientDrawable(int shape, float radius, int argb)
	{
		GradientDrawable bg = new GradientDrawable();
		bg.setShape(shape);// 设置形状
		bg.setCornerRadius(radius);// 设置圆角
		bg.setColor(argb);
		return bg;
	}

	public static StateListDrawable getStateListDrawable(Drawable normalBg, Drawable pressBg)
	{
		StateListDrawable selectorBg = new StateListDrawable();
		selectorBg.addState(new int[] { android.R.attr.state_pressed }, pressBg);
		selectorBg.addState(new int[] {}, normalBg);
		return selectorBg;
	}
}
